//
//  PaperSelfReportPanelView.swift
//  Exam-iOS
//
//  Created by 李胜锋 on 2018/3/20.
//  Copyright © 2018年 李胜锋. All rights reserved.
//

import Foundation
import UIKit

class PaperSelfReportPanelView: PaperBasePanelView {
    
    var selfReportBtn: UIButton!
    var selfReportHandle: VoidBlock?
    
    override func setup() {
        super.setup()
        
        
        leftBtn.snp.remakeConstraints { (maker) in
            maker.size.equalTo(CGSize.init(width: 36, height: 36))
            maker.top.equalTo(11)
            maker.leading.equalTo(11)
        }
        
        rightBtn.snp.remakeConstraints { (maker) in
            maker.size.equalTo(CGSize.init(width: 36, height: 36))
            maker.top.equalTo(11)
            maker.trailing.equalTo(-11)
        }
        
        selfReportBtn = UIButton.init(type: .custom).then({ (btn) in
            btn.setTitle("提交全部自评分", for: .normal)
            btn.setTitleColor(Config.default.themeColor, for: .normal)
            btn.titleLabel?.font = UIFont.systemFont(ofSize: 15)
            btn.clipsToBounds = true
            btn.layer.borderColor = Config.default.themeColor.cgColor
            btn.layer.borderWidth = 0.5
            btn.layer.cornerRadius = 18
            
            addSubview(btn)
            btn.snp.makeConstraints({ (maker) in
                maker.size.equalTo(CGSize.init(width: 150, height: 36))
                maker.centerX.equalToSuperview()
                maker.top.equalTo(11)
            })
            
            btn.rx.tap.bind { [weak self] in
                self?.selfReportHandle?()
                }.disposed(by: disposeBag)
        })
        
        progressView.snp.makeConstraints { (maker) in
            maker.leading.equalTo(20)
            maker.trailing.equalTo(-52)
        }
        
        indexLable.snp.makeConstraints { (maker) in
            maker.trailing.bottom.equalTo(-7)
            maker.height.equalTo(15)
            maker.centerY.equalTo(progressView.snp.centerY)
        }
    }
}
